#include <QFile>
#include <QWebSettings>
#include <QDebug>
#include <QDesktopWidget>
#include <QApplication>
#include "mainwindow.h"
#include "graphicshybridview.h"


MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent), m_view(this)
{
		
	m_hybridView = new GraphicsHybridView(this,0,"com.twitpic.uploader");
	m_hybridView->load(QUrl("qrc:/widget/main.html"));
	
	resizeEvent(0);	
	
	m_scene.addItem(m_hybridView);
	m_view.setScene(&m_scene);
	m_view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	m_view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setCentralWidget(&m_view);
}

void MainWindow::resizeEvent(QResizeEvent *event)
{
	QDesktopWidget *desktopWidget = QApplication::desktop();
	
	QRect clientRect;
	if(isFullScreen())
		clientRect = desktopWidget->screenGeometry();
	else
		clientRect = desktopWidget->availableGeometry();
	
	m_hybridView->resize(clientRect.width(),
						 clientRect.height());
}
